import Vue from 'vue'
import Router from 'vue-router'
import Home from '../pages/Home.vue'
import Cart from '../pages/Cart.vue'
import Index from '../pages/admin/Index.vue'
import Edit from '../pages/admin/Edit.vue'
import New from '../pages/admin/New.vue'
import Products from '../pages/admin/Products.vue'
import MyVuex from '../pages/MyVuex.vue'
import Details from '../pages/Details.vue'

Vue.use(Router);

export default new Router({
	routes: [
	{
		path: '/',
		name: 'Home',
		component: Home
	},
	{
		path: '/cart',
		name: 'Cart',
		component: Cart
	},
	{
		path:'/details/:id',
		name: 'Details',
		component: Details	
	},
	{
		path: '/admin',
		name: 'Admin',
		component: Index,
		children:[
			{
				path: 'new',
				name: 'New',
				component: New
			},
			{
				path: 'edit/:id',
				name: 'Edit',
				component: Edit
			},
			{
				path: '', //默认的路径
				name: 'Products',
				component: Products
			}
		]
	},
	{
		path: '/vuex',
		name: 'myVuex',
		component: MyVuex
	},
	]
});